package com.xiaojie.service.impl;

import com.xiaojie.annotation.MyTransactional;
import com.xiaojie.entity.Order;
import com.xiaojie.mapper.OrderMapper;
import com.xiaojie.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
//    @Transactional
    @MyTransactional
    public String  saveOrder(int a) {
        Order order=new Order();
        order.setName("测试订单");
        order.setOrderMoney(200D);
        order.setCommodityId(10000);
        orderMapper.save(order);
        a=1/a;
        return "订单添加成功";
    }
}
